<section id="content" class="table-layout animated fadeIn">
    <div class="tray tray-center">
        <div class="row">
            <div class="col-sm-8">
                <div class="panel panel-primary panel-border top">
                    <div class="panel-heading">
                        <span class="panel-title"> 
                        权限列表 | 
                        <a href="javascript:;" ng-click="loadModule()">载入权限</a>
                        </span>
                        
                    </div>
                    <div class="panel-body bg-light dark">
                        <div class="tree">
                            <ul>
                                <li ng-repeat="module in module_list">
                                    <span ng-click="setModule(module)"><span class="{{module.icon || 'fa fa-tasks'}}"></span> {{module.name}}</span>
                                    <ul>
                                        <li ng-repeat="sub_module in module.sub_modules">
                                            <span ng-click="setModule(sub_module)"><span class="{{sub_module.icon || 'fa fa-tasks'}}"></span> {{sub_module.name}}</span>
                                            <ul>
                                                <li ng-repeat="sub_sub_module in sub_module.sub_modules">
                                                    <span>{{sub_sub_module.name}}</span>
                                                </li>
                                            </ul>
                                        </li>
                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <!-- menu quick links -->
                <div class="admin-form">
                    <div class="panel heading-border panel-primary">
                        <div class="panel-body bg-light">
                            <form id="form-ui" name="form" ng-submit="newModule()" novalidate>
                                <div class="section-divider mb40" id="spy1">
                                    <span>添加/编辑 模块</span>
                                </div>
                                <!-- .section-divider -->
                                <!-- Basic Inputs -->
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="section">
                                            <label class="field">
                                                <input type="text" name="name" id="name" class="gui-input" placeholder="模块名称" ng-model="current_module.name" required>
                                            </label>
                                            <div ng-messages="form.name.$dirty && form.name.$error">
                                                <em ng-message="required" for="name" class="state-error">请输入模块名</em>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!-- Input Icons -->
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="section">
                                            <label class="field select">
                                                <select id="masters" name="masters" ng-model="current_module.pid">
                                                    <option value="{{master.id}}" ng-repeat="master in masters">{{master.name}}</option>
                                                </select>
                                                <i class="arrow"></i>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <!-- Input Formats -->
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="section">
                                            <label class="field prepend-icon">
                                                <input type="text" name="url" id="url" class="gui-input" placeholder="URL" ng-model="current_module.url">
                                                <label for="url" class="field-icon">
                                                    <i class="fa fa-globe"></i>
                                                </label>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="section">
                                            <label class="field prepend-icon">
                                                <input type="text" name="icon" id="icon" class="gui-input" placeholder="Icon-图标" ng-model="current_module.icon">
                                                <label for="icon" class="field-icon">
                                                    <i class="fa fa-globe"></i>
                                                </label>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <!-- Multi Selects -->
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="section">
                                            <label class="field prepend-icon">
                                                <input type="text" name="order" id="order" class="gui-input" placeholder="排序" ng-model="current_module.order">
                                                <label for="order" class="field-icon">
                                                    <i class="fa fa-globe"></i>
                                                </label>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="text-right">
                                    <button type="submit" class="button btn-primary">保存</button>
                                </div>
                                <!-- end .form-footer section -->
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
